package socks;

import java.io.IOException;

import java.io.InputStream;

import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

import android.util.Log;


public class SocketWrapper extends Socket {
	private boolean encripted = false;//是否加密
	private InputStream inputStream = null;
	private OutputStream outputStream = null;

	public SocketWrapper(String host, int port) throws UnknownHostException, IOException {
		super(host, port);
	}

	public SocketWrapper(InetAddress inetAddress, int port) throws IOException {
		super(inetAddress, port);
	}

	public synchronized InputStream getInputStream() throws IOException{
		if( inputStream == null ) {
			if ( encripted) {
				inputStream = new InputStreamWrapper( super.getInputStream() );
			} else {
				inputStream =  super.getInputStream();
			}
		}
		return inputStream;
		
	}
	
	public synchronized OutputStream getOutputStream() throws IOException{
		if( outputStream == null ) {
			if ( encripted) {
				outputStream = new OutputStreamWrapper( super.getOutputStream() );
			} else {
				outputStream =  super.getOutputStream();
			}
		}
		return outputStream;
		
	}
	

}
